#! /bin/sh
#
# usage: runtest [<testfile>...]
# without args, runs all *.test files in the current directory
#

MAKE="make MODE=debug"
DBG_SUFFIX="_dbg"

TESTFILES=$*
if [ "x$TESTFILES" = "x" ]; then TESTFILES='*.test'; fi
if [ ! -d work ];  then mkdir work; fi
rm -rf work/lib
cp -pPR lib work/       # OSX dos not support cp -a
opp_test gen $OPT -v $TESTFILES || exit 1
echo

# include precompiled.h first to all c++ file:
echo CFLAGS += -include inet/common/precompiled.h >work/makefrag

(cd work; opp_makemake -f --deep -lINET$DBG_SUFFIX -L../../../src -P . --no-deep-includes -I./lib -I../../../src; $MAKE) || exit 1
echo
opp_test run -p work$DBG_SUFFIX $OPT -v $TESTFILES || exit 1
echo
echo Results can be found in ./work
